package com.taobao.ui.widget;

import java.util.HashMap;
import java.util.Map;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;

import com.taobao.action.FillReceiveTaskAction;
import com.taobao.action.ReceiveAction;
import com.taobao.action.ui.ButtonAction;
import com.taobao.pojo.Receive;
import com.taobao.pojo.ui.ButtonNO;
import com.taobao.tools.Binding;

public class ReceiveFilterWidget extends CommonWidget {
	private Label label_1;
	private Label label_3;
	private Label label_4;
	private Label label_6;
	private Label label_7;
	private Label label_9;

	private Map<Button, Label> relateMap = new HashMap<Button, Label>();

	private ReceiveAction receiveAction = new ReceiveAction();

	public static final String ID = "com.taobao.ui.widget.ReceiveFilterWidget";

	@Override
	public String getID() {
		return ID;
	}

	/**
	 * Create the composite.
	 * 
	 * @param parent
	 * @param style
	 */
	public ReceiveFilterWidget(Composite parent, int style) {
		super(parent, style);
		GridLayout gridLayout_5 = new GridLayout(1, false);
		gridLayout_5.marginHeight = 0;
		gridLayout_5.marginWidth = 0;
		setLayout(gridLayout_5);

		Group group = new Group(this, SWT.NONE);
		group.setText("\u7528\u6237\u4FE1\u606F");
		GridLayout gridLayout_3 = new GridLayout(5, false);
		gridLayout_3.marginBottom = 10;
		gridLayout_3.marginWidth = 15;
		gridLayout_3.verticalSpacing = 0;
		group.setLayout(gridLayout_3);
		GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
		gridData.heightHint = 235;
		group.setLayoutData(gridData);

		Button button = new Button(group, SWT.RADIO);
		button.addSelectionListener(new ButtonAction(new FillReceiveTaskAction(), getThis(ReceiveFilterWidget.class), ButtonNO.INPUTSMALLER));

		label_1 = new Label(group, SWT.NONE);
		GridData gridData_5 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
		gridData_5.widthHint = 110;
		label_1.setLayoutData(gridData_5);
		label_1.setText("\u7B49\u5F85\u8F93\u5165\u5C0F\u53F7(0)");
		Binding.binding(getThis(ReceiveFilterWidget.class), label_1, Binding.GROUP_LABEL_BUTTON, Receive.class, "inputSmaller");
		relate(button, label_1);

		Label label_2 = new Label(group, SWT.NONE);
		GridData gridData_1 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
		gridData_1.widthHint = 50;
		label_2.setLayoutData(gridData_1);

		Button button_1 = new Button(group, SWT.RADIO);
		button_1.addSelectionListener(new ButtonAction(new FillReceiveTaskAction(), getThis(ReceiveFilterWidget.class), ButtonNO.PAY));

		label_3 = new Label(group, SWT.NONE);
		GridData gridData_9 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
		gridData_9.widthHint = 110;
		label_3.setLayoutData(gridData_9);
		label_3.setText("\u7B49\u5F85\u4E70\u5BB6\u4ED8\u6B3E(0)");
		Binding.binding(getThis(ReceiveFilterWidget.class), label_3, Binding.GROUP_LABEL_BUTTON, Receive.class, "pay");
		relate(button_1, label_3);

		Composite composite_11 = new Composite(group, SWT.NONE);
		composite_11.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1));

		Button button_2 = new Button(group, SWT.RADIO);
		button_2.addSelectionListener(new ButtonAction(new FillReceiveTaskAction(), getThis(ReceiveFilterWidget.class), ButtonNO.SENT));

		label_4 = new Label(group, SWT.NONE);
		GridData gridData_6 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
		gridData_6.widthHint = 110;
		label_4.setLayoutData(gridData_6);
		label_4.setText("\u7B49\u5F85\u5356\u5BB6\u53D1\u8D27(0)");
		Binding.binding(getThis(ReceiveFilterWidget.class), label_4, Binding.GROUP_LABEL_BUTTON, Receive.class, "sent");
		relate(button_2, label_4);

		Label label_5 = new Label(group, SWT.NONE);
		GridData gridData_2 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
		gridData_2.widthHint = 50;
		label_5.setLayoutData(gridData_2);

		Button button_3 = new Button(group, SWT.RADIO);
		button_3.addSelectionListener(new ButtonAction(new FillReceiveTaskAction(), getThis(ReceiveFilterWidget.class), ButtonNO.RECEIVE));

		label_6 = new Label(group, SWT.NONE);
		GridData gridData_8 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
		gridData_8.widthHint = 110;
		label_6.setLayoutData(gridData_8);
		label_6.setText("\u7B49\u5F85\u4E70\u5BB6\u6536\u8D27(0)");
		Binding.binding(getThis(ReceiveFilterWidget.class), label_6, Binding.GROUP_LABEL_BUTTON, Receive.class, "receive");
		relate(button_3, label_6);

		Composite composite_13 = new Composite(group, SWT.NONE);
		composite_13.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1));

		Button button_4 = new Button(group, SWT.RADIO);
		button_4.addSelectionListener(new ButtonAction(new FillReceiveTaskAction(), getThis(ReceiveFilterWidget.class), ButtonNO.CONFIRM));

		label_7 = new Label(group, SWT.NONE);
		GridData gridData_7 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
		gridData_7.widthHint = 110;
		label_7.setLayoutData(gridData_7);
		label_7.setText("\u7B49\u5F85\u5356\u5BB6\u786E\u8BA4(0)");
		Binding.binding(getThis(ReceiveFilterWidget.class), label_7, Binding.GROUP_LABEL_BUTTON, Receive.class, "confirm");
		relate(button_4, label_7);

		Label label_8 = new Label(group, SWT.NONE);
		GridData gridData_3 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
		gridData_3.widthHint = 50;
		label_8.setLayoutData(gridData_3);

		Button button_5 = new Button(group, SWT.RADIO);
		button_5.addSelectionListener(new ButtonAction(new FillReceiveTaskAction(), getThis(ReceiveFilterWidget.class), ButtonNO.ALL));

		label_9 = new Label(group, SWT.NONE);
		GridData gridData_4 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
		gridData_4.widthHint = 110;
		label_9.setLayoutData(gridData_4);
		label_9.setText("\u5168\u90E8(0)");
		Binding.binding(getThis(ReceiveFilterWidget.class), label_9, Binding.GROUP_LABEL_BUTTON, Receive.class, "all");
		relate(button_5, label_9);

		receiveAction.doAction(getThis(ReceiveFilterWidget.class));
	}

	private void relate(Button button, Label label) {
		relateMap.put(button, label);
	}
}
